document.addEventListener('plusready',function(){
	var ws = plus.webview.currentWebview();
	var id = ws.aid;
	console.log(apiRoot+"?m=home&c=medicinal&a=caseInfo&aid="+id)
	$.ajax({
		type:"get",
		url:apiRoot+"?m=home&c=medicinal&a=caseInfo&aid="+id,
		dataType : 'json',
		success :function(v){
			plus.nativeUI.closeWaiting();
//			console.log(JSON.stringify(v));
			if(v){
				$('.name').val(v.name);
				$('.sex').val(v.sex);
				$('.age').val(v.age);
				$('.departments').text(v.departments);	//医院科室
				$('.aidsname').text(v.aidsname);
				if(v.newly == 0){
					$('.newly').text('初诊：'); 
				}else if(v.newly == 1){
					$('.newly').text('复诊：'); 
				}
				if(v.hispic){
					var str1 = '';
					$.each(v.pic1, function(k, v) {
						str1 += '<img src="'+webRoot + v+'" data-preview-src="" data-preview-group="1" />';
					});
					$('.hispic').html(str1);
				}
				if(v.phispic){
					var str2 = ''; 
					$.each(v.pic2, function(k, v) {
						str2 += '<img src="'+webRoot + v+'" data-preview-src="" data-preview-group="2" />';
					});
					$('.phispic').html(str2);
				}
				$('.ztime').text(v.ztime);
				$('textarea[name=history]').val(v.history);
				$('textarea[name=phistory]').val(v.phistory);	//既往史
				$('textarea[name=recipe]').val(v.recipe);
				$('textarea[name=effect]').val(v.effect);
			}
		},
		error :function(e){
			console.log(JSON.stringify(e));
			errortoast();
		}
	});
})